/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.threapool.executor;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class threadTest {
    private final static ThreadPoolExecutor executor = new ThreadPoolExecutor(1,3,10, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>());
//    public static int atomicInteger = 0;
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger();
        while (atomicInteger.get() < 3) {
//            System.out.println("-----"+Thread.currentThread());
            executor.execute(new Runnable() {
                @Override
                public void run() {
//                    System.out.println("####"+Thread.currentThread());
                    System.out.println(atomicInteger.incrementAndGet());
                }
            });
        }
    }



}